package com.goldgov;

import com.goldgov.kduck.auth.filter.DuckAuthFilter;
import com.goldgov.kduck.security.RoleAccessVoter;
import com.goldgov.config.FilterProperties;
import com.goldgov.oauth2filter.PreRequestFilter;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cache.annotation.EnableCaching;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.security.access.ConfigAttribute;
import org.springframework.security.authentication.AnonymousAuthenticationToken;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.session.SessionRegistry;
import org.springframework.security.core.session.SessionRegistryImpl;
import springfox.documentation.swagger2.annotations.EnableSwagger2;

import java.util.Collection;

@SpringBootApplication
@EnableCaching
@EnableSwagger2
@ComponentScan({"com.goldgov", "com.kcloud"})
public class Application {
    public static void main(String[] args) {
        SpringApplication.run(Application.class, args);
    }

    @Bean
    public DuckAuthFilter duckAuthFilter(){
        return new DuckAuthFilter();
    }

    @Bean
    public SessionRegistry sessionRegistry(){
        //FIXME 需要对Session中的KEY值进行重新定义，目前oauth与web同一账号KEY不同
        return new SessionRegistryImpl();
    }
}
